package org.hcyspartnoc.demo.pojo.vo.traProgram;


import lombok.Data;
import lombok.NoArgsConstructor;
import org.hcyspartnoc.demo.pojo.po.traProgram.TraProgramPo;

import java.io.Serial;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

@Data
@NoArgsConstructor
public class VersionVo implements Serializable {


    private String major;

    private List<Version> versions;

    public void setMajorVersion(List<TraProgramPo> traProgramPos) {
        this.versions = new ArrayList<>();
        for(TraProgramPo traProgramPo : traProgramPos){
            Version version = new Version();
            version.setId(traProgramPo.getId());
            version.setName(traProgramPo.getVersion());
            this.versions.add(version);
        }
    }

    @Data
    @NoArgsConstructor
    public static class Version implements Serializable{
        private Integer id;

        private String name;
    }

}
